package org.dingfugui.triple.bean;


/**
 * Created by fugui.ding on 2015/3/31.
 */
public abstract class AbstractService implements Service {

    private Class cls;
    protected Object service;
    protected String name;

    public AbstractService(Class cls, Object impl) {
        if (cls.isInterface() && cls.isInstance(impl)) {
            this.cls = cls;
            this.service = impl;
            this.name = cls.getName();
        }
        //报错
    }


    @Override
    public String getName() {
        return name;
    }

    @Override
    public Class getType() {
        return cls;
    }

    @Override
    public Object getInstance() {
        return service;
    }
}
